package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorFormExplainDao;
import com.xbongbong.admin.domain.entity.MirrorFormExplainEntity;
import com.xbongbong.admin.model.MirrorFormExplainModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 镜像表单字段配置
 * @author xingxing.xiao
 * @date 2020/01/09 16:39
 */
@Service("mirrorFormExplainModel")
public class MirrorFormExplainModelImpl implements MirrorFormExplainModel {

    @Resource
    private MirrorFormExplainDao mirrorFormExplainDao;

    @Override
    public Integer insert(MirrorFormExplainEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorFormExplainDao.insert(entity);
    }

    @Override
    public Integer update(MirrorFormExplainEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorFormExplainDao.update(entity);
    }

    @Override
    public List<MirrorFormExplainEntity> findEntitys(Map<String, Object> param) {
        return mirrorFormExplainDao.findEntitys(param);
    }

    @Override
    public List<MirrorFormExplainEntity> insertBatch(List<MirrorFormExplainEntity> list) {
        mirrorFormExplainDao.insertBatch(list);
        return list;
    }

    @Override
    public MirrorFormExplainEntity getByMirrorFormId(Long mirrorFormId) {
        return mirrorFormExplainDao.getByMirrorFormId(mirrorFormId);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorFormExplainDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
